This is a great video describing the basics of the Bitcoin Improvement Protocol (BIP) 38, which details a standard for encrypting private keys.
One benefit BIP 38 gives is the ability to store private keys encrypted with a known standard and protected by a password that you can memorize. This means that if somebody were to gain access to a wallet in cold storage, they still wouldn’t have access to your Bitcoin.
The initial encryption is done using AES due to its ubiquity and proven effectiveness. However, AES is very fast and allows an attacker to quickly make many attempts at guessing your password. Therefore, Scrypt is added in the protocol because current hardware is not optimized for rapidly executing the memory-intensive Scrypt key derivation function (it typically takes a couple-hundred milliseconds to execute).
The result of this is that an attacker can’t quickly make attempts at guessing your password and is MUCH less likely to actually access your unencrypted private key.
The actual specification can be found here. There are some other features that I didn’t mention, so go check those out!