that part is clear. but how does it treat diffs?
What kind of diffs? Diffs between committed versions will typically both have $Id$. For diffs between checked out files and the repository, git replaces the $Id: ... $ string with $Id$ before the comparison.
Hmm... It does however seem like the git documentation isn't correct; it seems also $Id: ... $ strings are replaced on checkout.