It's hard to explain (even harder with words). I would definitely do it with vectors. Try to do it first in 2d. So the heightmap is 1-D greyscale bitmap. And the ball is circle.

So if you have values 0 and value 128 (grey) you can easily calculate the vector between those coordinates (0,0) and (1,12

From the vector you can create supportvector (dunno if it is the right word) of the terrain.

Then you can determine movement vector by adding gravity vector and terrains supportvector together. With 3D, it is bit complicated math of course