( Here's a published example, one of many that can be found if searching on 'heat treat vs. grain size' or other similar terms, that puts it fairly clearly; quoted from site:
http://www.heattreatconsortium.com/TechPro/HeatTreatChemistry.htm#Quenching )
"Grain Size
As molten metal cools, it aligns itself in to a precise regular structure that is called Unit Cells (bcc, fcc, bct). As the Cells form, they combine to form "Nucleation Sites". This process continues in all three dimensions, forming "Colonies" of Unit Cells. When the boundaries of the Colonies touch each other, a "Grain" or "Grain Boundary" is formed.
In general, the slower the cooling rate, the fewer the Nucleation Sites and therefore the larger the Colonies or the larger the Grain Size. Conversely, the faster the cooling rate the more Nucleations Sites and the smaller the Grain Size. The Grain Size effects the mechanical properties of the steel.
The smaller the Grain Size (cooled fast) the greater the strength. The larger the Grain Size (cooled slowly) the more ductile it is. Therefore, a part is cooled according to the desired property.
Iron-Carbon Phase
Steel is Iron with 0.0 to 2.0% carbon content. The location of the carbon atom within the Unit Cell is called the Interstitial Spots of the Unit Cell.
Steel with very little carbon is called Ferrite. Steel that has approximately 0.8% carbon is called Pearlite. Steel with a carbon content above 0.8% to 2% is called Cementite.
At more than 2% carbon, it is called "Cast Iron".
Ferrite is almost pure iron. It has little 'desire' to dissolve carbon and so there is little carbon in it. Since carbon gives steel the ability to become strong and hard, Ferrite is very weak steel. Ferrite exists at low temperatures only and is magnetic.
Pearlite is a mixture of Ferrite and Cementite. Pearlite exists at room temperature and is magnetic.
Cementite is a compound of iron and carbon known as "iron carbide". Its chemical formation is Fe3C. Cementite contains 6.67% carbon by weight. However, Cementite is present in the alloy between 0.8% and 6.67% carbon. As the percentage of carbon increases, more and more Cementite is present, until at 6.67% the entire mixture is Cementite. Below 2% it is considered steel and above 2% it is Cast Iron (carbon content by volume).
Finding Balance
The hardness, brittleness, ductility, and grain size of a steel is a result of the heating and cooling method that is used in the Heat Treat Cycle.
When steel is heated above the Transformation Temperature to form Austenite, and then quenched very rapidly it will most often transform into Martensite. It will be hard, strong and have a small grain size, but will also be brittle.
When steel is heated above the Transformation Temperature to form Austenite, and then cooled very slowly, it will transform into Ferrite, Pearlite and Cementite. This structure is comparatively softer, less strong, more ductile, and has a larger grain size.
The ideal properties for heat treated steel is hardness, strength, ductility and small grain size.
The selection process comes down to:
If a steel must hard and strong, quench rapidly. However, it will be brittle.
If a steel must have great ductility for machining, cool slowly. However, will not be very strong.
If the steel must have both strength and ductility, alloys can be added, but costs will increase.