<p>Are there any libraries (3rd party or built-in) in <code>PHP</code> to calculate text diffs?</p>

it depends exactly what you mean and what you want to do but there is
PEAR Text_Diff
- Engine for performing and rendering text diffs