S3 and S4 classes are two approaches to defining classes and objects in R. S3 classes are simpler and more prevalent, where a class is defined by adding a "class" attribute to a list. S4 classes have a formal definition using setClass() and require objects to be created with new(), providing more structure. Methods can be written for both by defining functions for generic functions like print() and show(). Reference classes build on S4 by adding an environment to benefit from object-oriented programming principles.