Standard & Poor’s Ratings Services is nearing a settlement with regulators over how the company graded real-estate bonds.