Did Grothendieck write about modular forms?
No.
That is perhaps a little too categorical, but a mathscinet search with Grothendieck as author and "modular form" or "forme modulaire" as "anywhere" gives no result. I don't remember him mentionning modular forms in "Recoltes et Semailles" either.
More to the point, it is a commonplace in the field of modular and automorphic forms to wish that Grothendieck had given some time to the subject -- and made it a little more "Grothendieck-style". Pierre Cartier gave a talk at the IHES in January 2009 where he deplored that "Grothendieck and Langlands never met".
Also, the correspondence between Serre and Grothendieck contains several letters where Serre tries to attract Grothendieck to the subject of modular forms, and where Grothendieck doesn't conceal his disinterest (to say the least).
In « Récoltes et Semailles » Grothendieck has a reflexion about the article of Langlands : « Automorphic representations, Shimura varieties, and motives » where he sees the influence of his ideas on the « motivic Galois group » that Langlands has may be found in the thesis of a student of Grothendieck : Neantro Saavedra Rivano or from Deligne. Grothendieck sees also his influence in the references made by Langlands on the so called « Catégories Tannakiennes » which were parts (not under this name) of his reflexions on motives.
Grothendieck writes that « la théorie à la Langlands des formes automorphes » is intimately linked to motives. He adds that he is regrettably ignorant of the theory of automorphic functions and that he doesn't know if he will have the occasion to change this fact.
I don't know any published work by Grothendieck specifically on modular forms.
It seems however that Grothendieck has spent some time thinking about moduli spaces of elliptic curves, for example. He has written a very long manuscript "La longue marche à travers la théorie de Galois", which is about what is now called Grothendieck-Teichmüller theory, if I'm not mistaken. At some point, he even seems to do some "explicit" computations... I don't know this text very well though, so I would appreciate the opinion of other people about it (note that the text isn't available anymore on the Grothendieck Circle website).
I would also say that there are at present many approaches of modular forms in the "Grothendieck style". Here I would mention the whole theory of automorphic forms, by Deligne, Langlands and many others, which is at the same time very abstract and very powerful.