How To: Add Application menu actions to Apple Magic Keyboard.
System Preferences > Keyboard > Shortcuts
CLICK App Shortcuts
CLICK +
SELECT 'Application' from drop down menu.
TYPE 'Menu Title'
PRESS 'FUNCTION KEY'
In this example I added a the Safari menu item 'BACK' to 'F13'.