Has Dave says will be for spindle feed back and the colours will probably be something like this but they could be anything has well.
Red = 5v (For LED)
Grn = 0v(gnd)
Yel = Signal +
blu = Signal -

If it's like most of these Slotted Optical sensors fitted on these machines there will be 2 slotted sensors, one for RPM signal and one for Index signal wired together each with 4 pins. Model number will be something like 306-061
pin1 = Signal +
pin2 = signal -
Pin3 = Led -
Pin4 = Led +

Like Dave said you really need the switch model number.