Currently there are two ways to make Rockbox send USB HID codes:
1) plug it in normally and let it go into USB mode, then press buttons while on the USB screen. This sends one of the several sets of USB HID codes we support, but they can't be redefined without changing and recompiling the Rockbox code. Many media player apps *do* support the multimedia keys, e.g. winamp has support for it in gen_hotkeys, it's just turned off by default (though in winamp at least, it doesn't capture the volume keys "properly" and it *also* controls the system volume at the same time).
You can use this with arbitrary applications via something like AutoHotkey on your PC: make it respond to the multimedia keys or any of the other sets of keys Rockbox can send, and instead send a particular hotkey to a particular app.
2) Plug it in while holding the charging-only button, then run the remote_control plugin. This has a different set of options/menus for what HID codes to send, but still can't be redefined without modifying the plugin and recompiling.
Someone could write a patch to make remote_control read a button configuration from a file, that would probably be useful.