It shakes everything on the battlefield with no choice for selecting what gets destroyed, the parts that are destroyed are simply the parts of the structure that get damaged like in any other earthquake.
Well it's almost certainly game mechanics. Because the game itself doesn't have a lot of aoe damage spells in general. There's only two spells that actually does damage to everyone one the map, Death Ripple and it only does damage to living creatures and Armageddon that does damage to everyone on the map, including your own.
Coupled with the fact that Earthquake is the only spell in the game that does damage to walls, having it deal damage to the enemies as well would've been pretty op.