I think that it is appropriate for a grandparent to discipline a child, especially if the grandparent is left as the one "in charge" while the parents are out/working/whatever. It's important that kids learn who the adults are in their life that are looking out for their well-being, and offering them structure and teaching them to comply with rules is one important way of teaching a child that they are secure and cared for.
That said, I do think it's important that the grandparent respect the parents' wishes in terms of the mode of discipline. For one, the parents are the people entrusted with the child's overall care and well-being, and their wishes should be respected. (Meaning if the parents say no spanking, the grandparents should respect that and not use spanking as a punishment). Also, if there is consistency between the rules AND the consequences at home and at other places the child is cared for (such as the grandparents' houses), the child will have an easier time following the rules - if they get a time out at home when they misbehave, they'll understand when grandma or grandpa says "Do that again and you'll get a time out."
Especially when they're young, kids spend a lot of their energy trying to make sense of the world, and one of the ways they do this is through looking for patterns, and therefore, consistency is really important when it comes to discipline!