The G8's are controling the look ahead function of the control if you have that option. G8 P1 turns it on and G8 P0 turns it off. This option will control the feedrate so as to more closely follow the part geometry and to reduce the "Stuttering" that happens when you go too fast.
G5.1 also controls a slightly different form of contouring known as AI NANO
If you don't have that option...just delete them.