You mixed up the order of the if and the variable definition, and you might want to check that the cast succeeded. Those lines should be:
Code:
local grenade = CastToGrenade( explode_entity )
if grenade ~= nil and grenade:Type() == Grenade.kEmp then
The rest looks fine to me. Just make sure that you have "FF Grenades" checked in the trigger's flags in Hammer.