Phase Transitions Of Exciton-Polaritons In Grating-Based Microcavities