A homeomorphism is an isomorphism between topological spaces. That is to say, it preserves the topological structure.
Let's forget the definition of a homeomorphism in terms of continuous maps for now, and try and construct it ourselves. If $X$ is a topological space, and $Y$ is a topological space that is 'the same' as $X$, up to renaming of the points, then that means that there is a bijective function
$$
f\colon X\to Y
$$
taking a point $x\in X$ to the corresponding point $y\in Y$. As a silly example, the topological spaces $\mathbb R\times\{0\}$ and $\mathbb R\times\{1\}$ are homeomorphic. The homeomorphism $f$ takes the point $(x,0)$ to the point $(x, 1)$.
Now we want $f$ to preserve the topological structure somehow. Since we want $X$ and $Y$ to be 'the same', up to the 'renaming' provided by the function $f$, then the open subsets of $Y$ should be precisely those sets $V\subset Y$ that correspond to open subsets $U\subset X$, via the map $f$. Putting this into mathematical language, we see that:
$V\subset Y$ is open in $Y$ if and only if the set $\{f^{-1}(y)\;\colon\;y\in V\}\subset X$ is open in $X$.
(remembering that $f$ is a bijection, so it has an inverse $f^{-1}$). If we think a bit harder, we can see that this is equivalent to the usual definition of a homeomorphism (left as exercise...)
This is very powerful. It means that any statement we can make about $X$ using purely topological language must also be true for $Y$. For example, if we say '$X$ has $4$ connected components', then that is really a statement about the open sets of $X$ - it is a topological statement. If $X$ is homeomorphic to a space $Y$ then $Y$ must have $4$ connected components too.
On the other hand, if we say $X$ has diameter $2$, then that is not a topological statement, and we should not expect it to be preserved by homeomorphism. For instance, the unit circle, which has diameter $2$, is homeomorphic to the unit square, which has diameter $\sqrt{2}$, and to a larger circle, of diameter $1000$.
Of course, you should still prove that $(\text{number of connected components})$ is a homeomorphism invariant, but in general, you can be sure that any definition made purely in terms of open sets and relations between them and the points of the space will be preserved by homeomorphisms.