Nexus 7: Assert failed: device == grouper when trying to install some roms
Interestingly I had this exact same problem. 

It seems to be an issue with the latest version of TWRP. I solved it by downgrading TWRP to 2.6.3.0 - I'm assuming there must be a bug with the 2.6.3.1 version.

That should work (as my scenario was the same: Nexus 7 (1), TWRP and the MIUI ROM).