Lily had heard what happened (quoted in the passage in question), from sources unknown*):
Snape had already shared with Lily that he thought Lupin was a werewolf:
"..every month at the full moon?", said Snape. "I know your theory,"
said Lily
Some further speculation would be that Snape himself had told her there was a tunnel, that he had seen Lupin go into it, and would be quite pleased to tell Lilly that her Gryffindor classmates, that he disliked so much, were up to something suspicious and have proof to back it up. From the same passage:
"They sneak out at night. There's something weird about Lupin. Where
does he keep going....I'm just trying to show you they're not as
wonderful as everyone seems to think they are."
Additionally, in Harry Potter and the Prisoner of Azkaban, Lupin explains what happened with Snape, James, Sirius, and the tree:
"Severus was very interested in where I went every month," Lupin told
Harry, Ron, and Hermione. "We were in the same year, you know and we
-- er -- didn't like each other very much. He especially disliked James. Jealous, I think, of James's talent on the Quidditch
field....anyway, Snape had seen me crossing the grounds with Madame
Pomfrey one evening as she led me to the Whomping Willow to transform. Sirius thought it would be - er - amusing to tell Snape all he had to do was prod the knot on the tree trunk with a long stick, and he'd be able to get in there after me. Well, of course, Snape tried it.
From these passages, we can see that Snape knew something was up with Lupin. Snape saw Lupin escorted to the tree. We can assume that Snape was somewhat free in talking about it (or at least confronted the Marauders with the information) as Sirius decided to tell him, essentially "you wanna follow him down the tunnel? Go poke the knot on the tree and see what you can find out."
Since it was clearly common knowledge, Lily had heard that Snape was in danger at the tree, and saved by Potter, it isn't unreasonable to assume then that she knew or assumed the tree was dangerous, and that there was something under it, since that was what Snape was trying to prove
*see Dumbledore's quote in book 1 about some secrets not staying secret among the student body: "What happened between you and Professor Quirrell is a complete secret, so, naturally, the whole school knows"