Metaclasses in Ruby are classes whose instances are classes. The metaclass defines the behavior of a particular class and its instances. Not all singleton classes are metaclasses - only singleton classes of classes are considered metaclasses. The key concept is that the metaclass allows control over the self/receiver in a given code block, which determines whether a method is defined as a class method or instance method. Sample code demonstrates how using class_eval, instance_eval, and defining methods with self affects whether a method is available on a class or instance.