I think the answer about ControllerMate is a good one, but since you asked in a comment about a configuration file, I'll mention that the most powerful, "raw" way to configure your keyboard settings is by creating a custom keyboard layout. I would guess that this is how apps like ControllerMate modify keyboard keys, but I can't say that for sure.
You can use an online generator for this purpose (it's old, but the .keylayout
files it generates still work under Snow Leopard) or a GUI like Ukelele (free).
When doing it this way, you would add the resulting .keylayout
XML file to /Library/Keyboard Layouts
(for use by all users) or ~/Library/Keyboard Layouts
(for use by only the current user). Then you would enable the custom layout in System Preferences -> Language & Text -> Input Sources.
For your third-party keyboard, it would still be tricky to find out the key code in a given mapSet for those "useless" keys for "Back", "Forward", "Mail", etc. Personally, I would go with a GUI program that allows me to "press and set" so there's no extra research or guesswork on my part.
So in short, I am not saying that this method is easier or even more powerful than using an app like ControllerMate, but it should at least help explain how keyboards can be re-mapped under OS X without a "middleman" program that has to stay running in the background.