I'm posting this because I just spent an hour trying to find out how to do it, and most sources say you can't. I don't like using my mouse. I especially don't like using it when I'm performing e-mail triage. That's one reason I liked the Gmail Web interface. So I went on a mission to transform Mail.app into a Gmail experience (I prefer to use Mail.app for reasons that are not really interesting), and mainly I just want to have keyboard shortcuts to file messages. The built-in command-1, -2, -3 ones for favorite mailboxes work fine for viewing, but mousing to either drag the message to a folder or go to Message --> Move to --> Thefolder was pissing me off. Because I AM NOT A PATIENT PERSON.
The issue was that, although it's pretty easy to add a keyboard shortcut to menu items (see here for an example out of dozens of tutorials), Mail.app has a few submenus with the same name (such as in both "Move to" and "Copy to"). Normally you can just type the exact menu item and it works; you don't have to fool with whether it's nested. But in this case, telling System Preferences the menu item name is useless because it exists under several options.
So, how to specify submenus to assign shortcuts?
You use "->" to do it. I know. It seems obvious once you see it. But you have no idea how many sources said you can't do it at all or just don't address it.