The BreakRepeat command should only be used in a Repeat loop and causes the macro to immediately exit the current Repeat loop (that is, the next macro command that is executed is the one after the matching UNTIL)
Goto Position=Top
Repeat
If $d_difficulty = 5
MsgOK Msg="First Difficulty 5 cache found in this database"
BreakRepeat
EndIf
GoTo Position=Next
Until $_eol