This is important when adding custom image sizes. The FoundationPress theme add new sizes by default. What happens is when you add new images sizes they go at the end of the list, so it would be, "Thumbnail, Medium, Large, Full Size, Small, XLarge". This is confusing to the user and will auto select medium normally. The best order is to have the image sizes in order from smallest to largest, then full size, then the thumbnail.
The important piece is after the comment "Unset WP Default sizes so they can be reordered with new custom sizes". This removes them from the list of available image sizes. Then right after you re-add them in order as well as custom sizes.
FoundationPress theme you can edit to add the "unset" rules then add them into the $sizes array. More generically, you can add this to functions.php.