The difference in the output files is probably NOT due to the compression method. By default GNU tar uses the standard GZIP deflate mode. One reason for the difference is in the format of GZIP compressed file.
The structure of the first 8 bytes of the GZIP header is as follows
OFFSET SIZE VALUE COMMENT
0 1 0x1F First "magic" id
1 1 0x8B Second "magic" id
2 1 CM Compression method
3 1 FLAGS 8-bit flag register
4 4 MTIME Object modification time
The problem is with the
MTIME field. For data that comes from a pipe this is the value of the current Unix time (seconds since Jan 1, 1970). Therefore two otherwise identical compressed archives created with at least one second interval from each other will be different.
Try to run
tar -cvzf twice on the same data and compare the results. The results will differ in the 5th byte, the lowest byte of the timestamp value.
$ tar czvf test1.tgz tmp/ ; sleep 2 ; \
tar czvf test2.tgz tmp/ ; md5sum test1.tgz test2.tgz