the 3.8% is a california state withholding for certain real estate sales. One of the exception for not witholding this is using the federal capital gain rules. as expalined by Goldfish. But some times a mistake at the title office will create this withholding at which you claim this on the sate return and usually get a full refund (however:this can cause the ugly AMT to make itself pop up on the Federal filing, causing more taxes)
Best advise work with both the RE, title and a Tax professional (CPA or EA) before closing.
If you sell your home for a profit above the current capital gains threshold of $250,000 per individual (or $500,000 per couple) then you would be required to pay the additional 3.8% tax on any gain realized over this threshold. Most people who sell their homes will not be impacted by these new regulations.