How can I create a shell context menu item that takes multiple files as arguments?
You can also try adding the program to the SendTo menu.
Browsing for the answer it seems that there is no simple fix and that a shell extension is needed. Looking again at the registry entries for DiffMerge, it appears to use a shell extension: DiffMergeShellExtension64.dll. If P4Merge does not have such a shell extension then it looks like the only way I could get it working correctly in the Windows Explorer context menu would be to write one myself.
The Complete Idiot's Guide to Writing Shell Extensions series in Code Project is a useful guide to writing shell extensions. Part II of the series is about writing an extension that handles multiple files at once (exactly what I need).
Warning: The Complete Idiot's Guide to Writing Shell Extensions uses C and COM, ATL (Active Template Library) and MFC (Microsoft Foundation Classes). So writing a shell extension, if you're not familiar with those technologies, is going to be a long and potentially difficult process; it's definitely not something you can do in an hour.