What exactly does Quran mean by "guarding chastity"?
Guarding chastity (from illegal sexual acts) is only an interpretation (read others) actually the Arabic wording exactly says those who keep (or preserve) their private parts (clean): Which implies those who only have intercourse with their husband/wife. And maybe long ago those man who had intercourse with a slave-girls they own or married. Or slave-woman who only had intercourse with their husband or their master (note: it's an exclusive or so they can't have intercourse with both).
Please note I won't quote slaves anymore, as I consider them no more legally existing, but of course they should be taken into account as described above for any later statement.
One could elaborate this to say in the allowed manner. As some if not all scholars prohibit anal sex... as you may find in this fatwa in Arabic language. Where the Sheik ibn Bazz adds that private parts should only be "used" for the allowed kind of intercourse.
Note that the Arabic word فروج used for the private parts literally means slit, slot or gap between two things, but refers to both male and female sexual organ it also refers to something which is often in threatening danger like an entrenched borderline city etc.. (See also in Arabic).
So to be called chaste: You should either avoid having intercourse at all (if you are not married). Or have intercourse in a legal manner: in an allowed manner with the allowed partner(s) -> husband-wife.
As to your question from the comment about Oral-sex: it could be accounted to both: So at least as long as there will not be any ejaculation we may find more scholars who may consider it as allowed. If not that is a rather prohibited way to have intercourse so that wouldn't be considered as chaste, but one can repent! But I'd recommend you to check answers on questions about oral-sex here on SE for more information. Note that according to the fatwa of ibn Bazz oral-sex wouldn't be allowed at all, as the private parts would be "used" in a non legal way for intercourse.
So what does losing chastity mean in Quranic terms?
Again the basis is the fatwa above: losing chatity would mean either having intercourse with somebody else then your husband or wife, or in case of not being married having illegal intercourse (no-matter how), or having homosexual intercourse, or having intercourse with wife-husband in an illegal manner-> anal.
And Allah knows best!