Take a look at revision 2 in this edit history. The revision appears to have nested code groups and is clearly malformatted:
However, clicking through to view the actual revision as it really appeared, one can see that it was formatted just fine:
We have improved the revision diff algorithm.
We're currently testing it here on Meta; once we're certain there are no problems, it will go out to the other sites as well. Your example was one of those I tested, and it is handled correctly by the new version.