What determines whether a substance can diffuse across the blood-brain-barrier?
Short answer
The two most important factors that favor passive diffusion across the blood-brain-barrier (BBB) are:


high lipid solubility;
low molecular weight.


And to a lesser extent:


absence of charge;
low affinity for BBB proteins;
not being a substrate for the efflux pumps present in the BBB.




Background  

The blood-brain-barrier (BBB) is principally formed by the endothelial cells in the capillaries of the central nervous system (CNS), as depicted in Fig. 1. Outside the CNS, the endothelial cells lining the capillaries allow for relatively free diffusion of substances from and to the blood via transcellular diffusion. In other words, substances can diffuse relatively freely to and from the blood via the extracellular space between the endothelial cells. In contrast, endothelial cells in the capillaries in the CNS are coupled via tight junctions, which prevents most compounds from diffusing into the extracellular space in between the cells (Fig. 1). Therefore, for compounds to enter the brain, they have to diffuse into the endothelial cells and back out again into the brain. This means they have to diffuse from the aqueous milieu in the blood, through the lipid-rich cell membrane and back into an aqueous solution in the extracellular space in the brain (source: University of Texas).       


Blood-brain-barrier. source: RIT 

Most drugs cross the blood-brain-barrier (BBB) by transmembrane diffusion, which is mainly dependent on whether the drug is able to meld into the cell membrane. A low molecular weight and high degree of lipid solubility favor this mechanism. However, a drug taken up by the membranes in the BBB must eventually dissolve into the aqueous environment of the brain's interstitial fluid to take effect. As a result, a substance that is too lipid soluble collects in the lipid portion, but is not able to leave the BBB. I.e., it enters the BBB, but doesn't cross it.

Moreover, lipid solubility also favors uptake by the peripheral tissues; this, in turn, lowers the concentration of the drug in blood. 

Thus, while lipid solubility can increase transport rate across the BBB, it can also lower the amount of the drug presented to the BBB. 

Factors in addition to lipid solubility include charge, tertiary structure and degree of protein binding. Chief among these secondary factors, however, is molecular weight. The best approximation of the influence of size on BBB penetration is that it is inversely related to the square route of molecular weight. Few substances over 500 Da cross the BBB. In addition, lipid-soluble substances with molecular weights over 400 Da can be substrates for P-glycoprotein, a major brain-to-blood efflux pump located at the BBB, which prevents or greatly retards a large number of small, lipid soluble molecules from entering the CNS. However, Peptides and proteins with molecular weights in excess of 600 Da are known to cross the BBB in amounts sufficient to affect CNS function, such as the enkephalins. The largest substance found to date to cross the BBB by the mechanism of transmembrane diffusion is cytokine-induced neutrophil chemoattractant-1 at 7.8 kDa (Banks, 2009).

Note that some parts of the brain do not feature a BBB, including but not limited to, the pituitary, area postrema and pineal gland. Many of these areas participate in hormonal control. These structures hence need to be in contact with the blood stream to sense the presence of hormones and other compounds (source: University of Texas).

Reference
- Banks, BMC Neurol (2009); 9(Suppl 1): S3