What was it..
It is nothing but her saliva.
The purpose is to get revenge. Earlier Greta had called Amy a rich spoiled girl (most probably), with which she disagreed. But she could not confront Greta as she was in disguise. So when she had the moment she spat in her glass.
It was her own way of taking revenge on Greta. She did it so that she can have the pleasure of watching Greta drink her saliva.
Also..as iandotkelly points out, she is a sociopath. She did not have anything against men in particular. It could be anyone who offended her. To prove this, the author Gillian Flynn added this thing as she says here:
.....Flynn confesses, "She was in the first draft, because I liked to show that Amy’s skillset wasn’t just aimed at men, which is why I have her spit in Greta’s drink (in the movie). She’s someone who upon a slight is going to take care of it."