I cover the history of interpretation of this phrase whenever I teach Pauline Epistles and thought I'd share some what I give to my students here.
The view that "works of the law" relate to the ceremonial precepts is found as early as Origen:
“One should know that the works which Paul repudiates and frequently criticizes are not the works of righteousness [opera iustitiae] which are commanded in the law, but those in which they boast who keep the law according to the flesh; that is, the circumcision of the flesh, the sacrificial rituals, the observance of Sabbaths and new moon festivals [cf. Col 2.18]. These and works of a similar nature are the works by which he says no one can be saved, and concerning which he says in the present passage, ‘not on the basis of works; otherwise, grace would no longer be grace.’ For if anyone is justified through these, he is not justified gratis. But these works are by no means sought from the one who is justified through grace; but this one should take care that the grace he has received should not be in him ‘in vain’ [cf. 1 Cor 15.10] . . . So then, one does not make grace become in vain who joins works to it that are worthy and who does not show himself ungrateful for the grace of God. For anyone who sins after having attained grace becomes ungrateful to him who offered the grace.”—Origen, Commentary on Romans 8, 7, 6. Cited from Thomas Scheck, Origen and the History of Justification: The Legacy of Origen’s Commentary on Romans (Notre Dame: University of Notre Dame Press, 2008), 48–49.In addition, here is a bit from Jerome on Galatians 3:2 ["Let me ask you only this: Did you receive the Spirit by works of the law, or by hearing with faith?"]:
Augustine, on the same passage, recognizes that the term refers to both the ceremonial precepts as well as the moral laws.
“There are indeed many things, he says, which could under interrogation compel you to prefer the gospel to the law; but since you are senseless and are by no means able to hear these things, I should speak with simple words to you. I should ask about what is at hand: whether it was works of the law, observance of the Sabbath, the superstition of circumcision and new moons that gave you the Holy Spirit that you received? . . . . Let us consider carefully that he does not say, ‘I want to learn from you’ whether you ‘received the Spirit by works, but instead ‘by the works of the law.’ For he knew that even Cornelius the centurion had received the Spirit by works but not by ‘works of the law,’ with which he was unacquainted. But if, on the other hand, it is said: well then, the Spirit can be received even without the ‘hearing of faith,’ we will respond that he [Cornelius] did indeed receive the Spirit, but by the ‘hearing of faith’ and by natural law, which speaks within our hearts the good things that must be done and the evils that must be avoided.”—Jerome, Commentary on Galatians on 3:2. Cited from Thomas P. Scheck, trans., St. Jerome’s Commentaries on Galatians, Titus and Philemon (Notre Dame: University of Notre Dame Press, 2010), 114.
“Here he begins to demonstrate in what sense the grace of faith is sufficient for justification without the works of the law. . . . But so that this question may be carefully treated and no one may be deceived by ambiguities, we must first understand that the works of the law are twofold; for they reside partly in ceremonial ordinances and partly in morals. To the ordinances belong the circumcision of the flesh, the weekly Sabbath, new moons, sacrifices and all the innumerable observances of this kind. But to morality belong ‘You shall not kill, you shall not commit adultery, you shall not bear false witness’ and so on. Could the apostle possibly not care whether a Christian were a murderer and adulterer or chase and innocent, in the way that he does not care whether he is circumcised or uncircumcised in the flesh? He therefore is specially concerned with the works that consist in ceremonial ordinances, although he indicates that the others are sometimes bound up with them. But near the end of the letter he deals separately with those works that consist in morals, and he does this briefly, but he speaks at greater length regarding the [ceremonial] works . . .”—Augustine, Commentary on Galatians on 3:2. Cited from Thomas P. Scheck, trans., St. Jerome’s Commentaries on Galatians, Titus and Philemon (Notre Dame: University of Notre Dame Press, 2010), 114.
|St. Thomas Aquinas|
“ . . . he is speaking here about keeping the commandments of the Law insofar as the Law consists of ceremonial precepts and moral precepts.”—Thomas Aquinas, Commentary on Galatians, ch. 3, lecture 4. [source]It is worth noting that the Reformers seem to have been aware of this interpretive tradition. Calvin writes the following:
“Now the question is, what is meant by the works of the law? The Papists, misled by Origen and Jerome, are of opinion, and lay it down as certain, that the dispute relates to shadows; and accordingly, assert, that by ‘the works of the law’ are meant ceremonies. . . For they see no absurdity in maintaining that ‘no man is justified by the works of the law,’ and yet that, by the merit of works, we are accounted righteous in the sight of God. In short, they hold that no mention is here made of the works of the moral law. But the context clearly proves that the moral law is also comprehended in these words; for almost everything which Paul afterwards advances belongs more properly to the moral than to the ceremonial law. . .”—John Calvin, Commentary on Galatians at 2:15. Cited from John Calvin, Calvin’s Bible Commentaries (J. King, trans.; Forgotten Books, 2007), 54.The issues here are complex and I can't get into this in greater detail. Suffice it to say, obviously Catholic tradition does not necessarily reduce the term to ceremonial laws (see Aquinas!). You can find a bit more discussion on this in my response to James Dunn in Four Views on the Role of Works at the Final Judgment (Zondervan, 2013).
Let me just bring this to a close with Michael Bird's own discussion of the issue:
“It is genuinely tempting to say that these ‘works’ refers to acts of personal righteousness completed prior to the giving of the law, rendered plausible by the contrast of gift and debt in vv. 4–5. But that is only half the story, for in Paul’s epistles ‘law’ and ‘works of the law’ ordinarily signifies the Mosaic legislation. . . A specific work in mind is probably circumcision since Paul appeals to Abraham’s not-yet-circumcised-state in Gen. 15.6, the preceding references in 3.27–31 pertains to boasting in Jewish identity which circumcision epitomized, circumcision was a sign of the Mosaic covenant (Gen 17.11; Acts 7.8; Jub. 12.26–28; m. Ned. 3.11), and references to circumcision buttress the passage in 3.30 and 4.9–12. Furthermore, circumcision was regarded as the very means of entering Israel for Gentiles (Jdt. 14.10; Esth. 8.17; m. Shab. 19.3) and in several second-temple texts a necessary component of salvation (Jub. 15.25–34; CD 16.4–6; T. Levi 6.3; cf. Acts 15.1).”—Michael Bird, The Saving Righteousness of God: Studies on Paul, Justification, and the New Perspective (Paternoster Biblical Monographs; Eugene, OR: Wipf and Stock, 2007), 74.