In this paper, we describe the neural grammar network (NGN) and its application to quantitative structure-activity relationship (QSAR) in computational chemistry. The NGN is a novel machine learning device that applies the generic function approximation capability of a dynamic recursive neural network to the syntactic structure of a parsed string. In our QSAR task, we represent each molecule by a formal string representation (SMILES and InChI), and utilize an NGN instance to associate each with a real-value that describes the degree of binding, inhibition or affinity a given molecule has with a target protein. We find that the NGN can on average outperform previous work in regression tasks, yielding performances of up to 0.79 (sd = 0.23) in predictive r-squared scores and up to 74.8 (sd = 1.63) percent concordance in classification tasks.