Nestlé produces brands including Smarties and KitKat, and Masterfoods' brands include Mars and M&Ms.
Bassham will report to Grayling UK chief executive Amanda Riddle.
Riddle said Bassham had a ‘detailed understanding of the food industry' that would ‘strengthen our existing expertise in this area'.
Bassham - who ran Nestlé's UK press office for three years - will also work on Grayling's account with Heinz. The agency has advised Masterfoods for 30 years.
Nestlé is recruiting to replace Bassham. The appointee will become head of corporate comms to oversee media relations, corporate work, community programmes and online comms.
Nestlé corporate comms director Ian Rayson - to whom Bassham reported - declined to comment further on the post.
At Grayling, Bassham replaces director Lisa Keogh, who left at the end of last year after more than four years with the agency. Keogh now holds the post of director at The B2B Consultancy.