Is "but on what grounds did not appear" ungrammatical?

The sentence is perfectly grammatical. If you read the whole paragraph, Oliver filed with the court (presented) a petition for appointment of new trustees of the testator‘s will. This (referring to the petition) was opposed (resisted) by Ray & Bush, but the grounds for opposing the petition did not appear (were‘t stated in anything Ray & Bush filed with the court in opposition). Nonetheless, the petition was denied. So “on what grounds” refers back to the petition for appointment of the new trustees.


Paraphrase

The petition was resisted but the grounds for resisting it were not provided.