Corn syrup is used in pecan pie to create a smooth texture in the filling by stopping the sugar from crystallizing.