We describe the use of grammars as an approach to automatic function definition in Grammatical Evolution. The automatic generation of functions allows the evolution of both the function and the code belonging to the main body of the program which has the ability to call upon the evolving function. As proof of concept we apply a grammar using automatic function definition to the Santa Fe ant trail. Results show that the evolutionary search successfully evolves code for the automatically defined function and calls upon this function from the main code to generate solutions to the Santa Fe trail. An analysis of the number of successful runs shows a speed-up in terms of the number of generations required to find a solution when compared to standard Grammatical Evolution.