By granting you a stock option, your company gives you the right to buy its stock at a fixed price during a specified period. This right does not cost you anything, at least under the design of most US stock plans. However, to exercise the option you must buy the shares at your fixed exercise price; your gain is the difference (often called the "spread") between this fixed purchase price and the actual cost of the shares on the open market at the time of exercise. Those who do not have enough cash to pay for the shares often use a method called a "cashless exercise" (see a related FAQ).
Restricted stock (along with its nearly identical twin restricted stock units, often called RSUs) is also usually granted without any cost to you. In some states a nominal amount must be paid (e.g., par value). Some private companies grant early exercise stock options, in which case you actually buy restricted stock.
Similarly, with an employee stock purchase plan (ESPP), while there is no cost or fee to participate, you do have a cost when you buy shares. These purchases usually occur on fixed dates with accumulated salary deductions.
For companies, stock grants, whether options, restricted stock, or ESPP discounts, are not free. Under rules established in 2005 by the Financial Accounting Standards Board (FASB), companies must recognize an accounting expense at grant for the "fair value" of all forms of stock-based compensation (see a related FAQ). In addition, there are the costs of designing and administering the plan.