page 36 tells how you set the MIDI mappings for H9. You just assign a MIDI CC value to Tap Tempo and that's it. This can also be done more easily in H9 Control.
That's all I can help. You need to ask Boss about how you generate a MIDI CC from you external switch via ES-5, but I'm pretty sure this is doable.