Don't know what it is for but it goes to a switch inside the targa holder. The switch is not activated by the cover being open, it is only depressed by the targa top when it is put in the cover.
My guess is that there is a switch to let you know that the top is ajar when it is on the car. When you remove the top the switch is opened and when the top is put in the holder the circuit is again closed by the switch. Like Robert said, to turn off the warning.