If you lightly spray the leaves with soapy water, they will quit eating them. It won't hurt the plants or the Basil's flavor. They're little caterpillars and they do not like soap ! Give it a try ! Spray them before dark and they won't be back!
Mr. Wayne is exactly right. Spray the Safer Soap right on the plants when the worms are there. The soap kills them. Wash it off and it won't kill any other insects you don't want killed, like ladybugs or praying mantis.