The reason for the second set of pins is described in the comment:
// HOODLOADER2 means running sketches on the atmega16u2
// serial converter chips on Uno or Mega boards.
// We must use pins that are broken out:
#else
#define RESET 4
#define LED_HB 7
#define LED_ERR 6
#define LED_PMODE 5
Since the code could also run on an atmega16u2 with less usable pins.
Incidentally, I have also recently joined the ranks of those who have created a custom programmer. You might find something of use to you here: Multiprog v1.0 - Combined HighVoltage + ISP + USBTTL adapter/programmer - Exhibition / Gallery - Arduino Forum