While I am not a professional, I have had some training relating to volunteer activities. The behavior you are describing is very disturbing coming from a 9 year old. It seems very likely that she has been sexually abused.
Your suspicions about her grandparents may well be appropriate, but because of the custody battle you are wise to not accuse them. I would get in contact with her current counselor right away, and if they do not seem concerned, I would find another who specializes in sexually abused children.
I also wouldn't continue to question her about her grandparents, for two reasons. One, you might be accused of trying to brainwash her yourself, and two, professionals know how best to question a child about these issues. You wouldn't want to cause more emotional damage or make her less likely to be honest in an investigation.
Approach everyone in this case, from CPS, her therapist, your attorney, to the judge, etc. from the perspective that your are troubled and worried about her, and that you want to get her help and make sure she is not being harmed by anyone.
Meanwhile, love on her and calmly let her know that this type of behavior isn't appropriate. More discussion of what is private behavior is necessary. You also need to make sure she isn't exposing your younger children to any type of sexual behavior.
I hope this is helpful. May God bless you all.