ne … que
construct expresses a negative meaning in the same way that “nothing but” does in english.
Je ne mange que des légumes
means “I eat nothing but vegetables”
Your example is a bit more subtle, but works in the same way:
Je ne comprends que lorsque…
becomes “I understand nothing, except when…”, which in more common English would become “I only understand when”
In terms of the resources you were asking for, you may want to check this existing question
Incidentally, the same can be said for the following sentence:
Ce n‘est que parce que je t’aime qu’il m’arrive parfois de me montrer dure avec toi.
It’s only because I care about you that I might sometimes come across as harsh towards you.