A federal appeals court tossed out sentences and a verdict stemming from a shooting in Baghdad in 2007 that left 31 Iraqi civilians dead or wounded.