Can you get the effect that you want with the existing format options? I don't know exactly what is wanted here, but how about something like the following shell script?
diff --old-group-format='old=%dn ' --new-group-format='new=%dN ' --unchanged-group-format='unchanged=%dn ' --changed-group-format='changed=%dn,%dN ' OLD NEW where OLD and NEW are the files being compared. This way, you wouldn't need to alter GNU diff, and could just use the options that are already there. These formats are designed for the kind of specialized situation that you ran into.
