This is documented behavior; the grep manual says that when grep is reading a binary file it "may treat non-text bytes as line terminators". You can use grep's -a (--text) option to if you want to match null bytes.