The algebraic structure of BRST quantization