I've handled this type of case a number of times.
The answer to your specific question depends upon the manner in which the grandmother obtained custody of the child, and whether or not you have had your parental rights determined in any way. For example, if you were not married to the mother and you have not either admitted paternity or had a court determine that you are the father, then the first step would be to establish that in fact you are the legal father. If that has already been done, and there are no restrictions placed upon you by a court then you may be able to get your child without any court order whatsoever. If there are some restrictions, then your exact circustances would disctate what you should do.
You should discuss the matter with a family law attorney in your area.