Within a single drilling operation, individual holes are sorted according to whether the two options Order by depth and Optimize order are enabled. When these two options are disabled, the holes are sorted in the sequence in which they were selected.
The Order by depth option allows you to group holes together that have their tops at the same depth. On most machine controls, this reduces the amount of cycles that are output. In addition, it may sometimes be beneficial to finish one level of holes before moving to another.
The images above show a simple part with holes in three planes. At the left, Order by depth is disabled. At the right, Order by depth is enabled. In both cases, Optimize order is enabled.