That is called "torque seal" or "torque putty".
It is used by mechanics to mark a part after it has been properly torqued, and thereafter to serve as an indication if loosening has taken place. The torque seal hardens after application and serves as a marking mechanism that will show—by cracking and/or flaking of the putty—if the part has loosened resulting in rotation.
The photo below shows torque seal as initially applied (left), and then with the seal broken following loosening an rotation of the nut (right).
Image courtesy of theleanwarehouse
Just to be clear, the torque seal does nothing to secure the part or otherwise serve any locking function. It serves only as an indication.
Dykem is one manufacturer of torque seal.
Here is a page with additional information about torque seal from a retailer.