See the question and my original answer on StackOverflow

Have you looked at LogSubstPol on codeplex?

I quote:

LogSubstPol is a TFS check-in policy which inserts the check-in comments and other keywords into your source code, so you can keep track of the changes even if you are not connected to TFS. It can be compared with the $log$ (and other) substitition in any other CVS systems.

Otherwise, you can write your own :-) It should be based on TFS checkin policy extensibility, using the PolicyBase Class