Sort Grammar Rules