How does UVM Comparator works?

All of the comparators provided by UVM are in-order. The first transaction received on the before_export port will be compared to the first transaction received on the after_export port. If you want to do any out-of-order comparison, you will need to write the comparator yourself.