The folks at Ask MetaFilter along with lifehacker Matt Haughey offer a solution for ".gif" Gmail spam with a custom filter:

I tried this (filter):

Has the Words | multipart/related .gif
X Has attachment

And to forward everything to the trash (which will automatically clear after 30 days.)

Personally I've set up a "Spam-probably" label which uses this criteria, plus one that checks for the same To: and From: address - and that's caught 426 messages in the last 4 days. Damn you evil spammers!!! — Gina Trapani