Difficulty is directly related to Bitcoin mining (see mining below), and how hard it is to verify blocks in the Bitcoin network. Bitcoin adjusts the mining difficulty of verifying blocks every 2016 blocks. Difficulty is automatically adjusted to keep block verification times at ten minutes.

Reference:

https://support.blockchain.com/hc/en-us/articles/213276463-Bitcoin-terms-glossary

This is a measure of how difficult it is to find a new block compared to the easiest it can ever be. By definition it is the maximum target divided by the current target. This number determines how difficult it is to hash a new block. It is related to the maximum allowed number in a given numerical portion of a transaction block’s hash. The lower the number, the more difficult it is to produce a hash value that fits it. Difficulty varies based on the amount of computing power used by miners on the Bitcoin network. If large numbers of miners leave the network, the difficulty would decrease. Thus far, however, Bitcoin’s growing popularity has attracted more computing power to the network, meaning the difficulty has increased. Difficulty is used in two Bitcoin rules: 1) every block must meet a difficulty target to ensure a ten minute interval between blocks and 2) transactions are considered confirmed only when belonging to a main chain which is the one with the biggest cumulative difficulty of all blocks. As of September 5, 2013 the difficulty was 86 933 018 and grows by 20-30% every two weeks. On average, a block is produced every ten minutes. However, the number of miners and the amount of computing power does not remain constant. As Bitcoin becomes more popular, greater computing power means a reduction in the amount of time it takes to produce a block. Therefore, at regular periods, the difficulty of the problems miners must solve to produce a block is recalculated to keep the rate of block production at about ten minutes. Every 2016 blocks, Bitcoin adjusts the difficulty of verifying blocks based on the time it took to verify the previous 2016 blocks. The difficulty is adjusted so that given the average estimated computing power of the entire Bitcoin network, only one block will be verified on average every ten minutes for the next 2016 blocks. The difficulty is usually expressed as a number, optionally accurate to many decimal places. ( For example, in block 100,000 the difficulty was expressed as 14,484.162361.) The difficulty is inversely proportional to the hash target, which is expressed as a hex number with approximately 50 digits, and is the number under which a block’s generated hash must be to qualify as an officially verified block. The hash target is equal to ((65535<<208/difficulty). Mining consists of attempting to find a hash of: the previous block, the current set of un-blocked transactions, a transaction indicating where the block reward plus fees should be paid, and a nonce (number once used). Since any change to the nonce will randomly change the resulting hash, mining involves trying trillions of different nonce values in order to find a hash that is numerically below the current difficulty number, thereby solving the block. In theory the first hash tried could solve the current block. But that is unlikely in practice. Every hash has an equal chance of solving a block. So, while there is an average time to solve a block, theoretically there is no limit to the length of time it might take to solve a block. Difficulty is also often called block difficulty, hash difficulty, verification difficulty, or the difficulty of generating bitcoins.

Reference:

Malone, J.A (2015). Glossary of Bitcoin Terms and Definitions. United States: Lulu Press, Inc