From Visual Studio 2005 SP1 on, there's an undocumented registry switch to enable debug messages which show the guid and id of a selected menu or command. To enable this hidden switch, you'll have to add a dword registry entry under [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\General] which is called EnableVSIPLogging. It should have a value of 0x00000001 (hexadecimal 1).
After restarting Visual Studio 2008, you can now identify menus and commands by pressing STRG+SHIFT and clicking on the menu or command.
For instructions on enabling this for Visual Studio 2005, see this article.