BRF, a Brazilian meatpacking company, has settled for $40 million a lawsuit brought by the company’s shareholders, accusing it of engaging in bribery in order to hide unsanitary practices at its plants.