Just wrote a class to compute smallest (not to be taken literally) number of edits to transform one string into another string:
http://www.raymondhill.net/finediff/
It has a static function to render a HTML version of the diff.
It’s a first version, and likely to be improved, but it works just fine as of now, so I am throwing it out there in case someone needs to generate a compact diff efficiently, like I needed.
Edit: It’s on Github now:
https://github.com/gorhill/PHP-FineDiff