Set up a Mail rule: If "Any Attachment Name" contains ".gif" "Move Message" to mailbox "Junk".
Its a bit draconian, but hasn't had any false positives here. If you're worried just set the color of the message text or background instead of moving it.
[kirkmc adds: I agree that I've never gotten a valid message that contains a gif file, so this is a perfectly useful rule. If you do get messages containing gif files, then don't use the rule, or check your Junk mailbox often.]

