I'm a little confused as to what this counts:
zgrep -B 4 "xyz" <filename> | grep -i abcd | wc -l
Prints every 'xyz' and 4 lines before from the file.
zgrep -B 4 "xyz" <filename>
Prints only lines, containing (case-insensitive) 'abcd'.
grep -i abcd
Counts the lines.
All in all, it shows how many case-insensitive 'abcd' line can be find in file being withing 4 lines before 'xyz'.