(Remark: if you haven't sketched the function $h$ -- on paper, or in your head if your visual imagination is up to it -- then you absolutely should do that first. Don't try to do this sort of thing just by pushing symbols around.)
Obviously the function $h_0\,:\,\mathbb{R}\rightarrow\mathbb{R}$ with "the same definition" as $h$ isn't continuous. So what's different when you're mapping from $\mathbb{Q}$? Only the fact that the points $\pm\sqrt{2}$ aren't in $\mathbb{Q}$, and those are the points in $\mathbb{R}$ where $h_0$ fails to be continuous.
So, suppose you have some point $x_0$ that _isn't $\pm\sqrt2$. You need to show that $h$ is continuous there, which means you need to find an interval around $x_0$ in which $h$ is well-behaved.
Usually "well-behaved" would be defined in terms of how much you're allowing the value of $h$ to change -- "for all $\epsilon>0$, there is some $\delta>0$", etc. -- but in this particular case $h$ is constant on any interval that doesn't include $\pm\sqrt2$.
And so that's the idea. Given $x_0$, we know it doesn't equal $\pm\sqrt2$ because those values aren't rational. So we can find an interval around $x_0$ small enough to stay away from those points. How small does that interval need to be? Its radius needs to be smaller than the distance from $x_0$ to either $+\sqrt2$ or $-\sqrt2$. That's where the definition of $\delta$ comes from. And once we have an interval around $x_0$ that avoids those points, we know that $h$ is constant there.