The damage is scaled with relative speed. And it has a threshold you can set in the template (could be 0 too).
It's called charge in the code but trampling could be somewhat descriptive too since it's any collision that would trigger the effects.
I agree with all that @guerringuerrin said. Those tests look really good, and in such tight spaces.
@Atrik, since I guess now with inertia units need to accelerate, is heavy cavalry dealing "charge" damage only when at max speed? (I'm not sure if this is what's called "trampling", which wouldn't be the same thing in reality). Because I guess that would be nice, one would need to repeatedly move out and smash for that to be more effective, similarly to how it should really work for ramming ships, although elephants I guess could charge out when mobbed.