Dynamic heightmap editing

I am just curious how this would work. Basically, in these games where there is an explosion or whatnot, the terrain gets a crater, and lowers itself.

I would imagine this is dynamic editing of the heightmap, correct? How would one go about doing this?

Also could this same concept be applied to, say, a planet with a heightmap stretched around it, to get craters such as in spore?? Thanks