It is certainly possible to give $\Bbb R\cup\{P\}$ the topology $$\tau_3=\tau_e\cup\{X\setminus F:F\text{ is a finite subset of }\Bbb R\}\;,$$ and the resulting space is indeed compact. It is not, however, Hausdorff: if $x\in\Bbb R$, there do not exist $U,V\in\tau_3$ such that $x\in U$, $P\in V$, and $U\cap V=\varnothing$. The space $\langle X,\tau_2\rangle$, on the other hand, is Hausdorff, and since it is compact and Hausdorff, it is even normal. (In fact it turns out to be homeomorphic to $S^1$, the unit circle, so it is even metrizable.) Thus, $\langle X,\tau_2\rangle$ is a much nicer space than $\langle X,\tau_3\rangle$. Thus, if we’re looking for a nice compact space that has $\Bbb R$ as a dense subspace, $\langle X,\tau_2\rangle\rangle$ is preferable to $\langle X,\tau_3\rangle$. (Some people even make Hausdorffness part of the definition of compactness, so for them the space $\langle X,\tau_3\rangle$ isn’t compact.)
In any case, these examples are almost certainly setting you up for the definition of the one-point (or Alexandroff) compactification. A compactification of a space $X$ is an embedding of $X$ into a compact Hausdorff space $Y$ as a dense subspace. Your examples embed $\langle\Bbb R,\tau_{\text{disc}}\rangle$ and $\langle\Bbb R,\tau_e\rangle$ as dense subsets of compact Hausdorff spaces, so they are example of compactifications. My example above is an embedding of $\langle\Bbb R,\tau_e\rangle$ into $\langle X,\tau_3\rangle$ as a dense subset, and $\langle X,\tau_3\rangle$ is compact, but it’s not Hausdorff, so this is not an example of a compactification of $\langle\Bbb R,\tau_e\rangle$.
Your examples are not just compactifications: they are compactifications in which only one point has been added to the original space, hence the name one-point compactification. It turns out that such a compactification of a space $\langle X,\tau\rangle$ exists if and only if $X$ is a locally compact Hausdorff space, and in that case the one-point compactification is defined exactly as in Example 2: the open nbhds of the new point $P$ are the sets of the form $\{P\}\cup(X\setminus K)$, where $K$ runs over all compact subsets of $X$.