The same rule explained here regarding 2nd base applies to 3rd base. The runner advancing to 2nd or 3rd base on a ground ball that does not leave the infield MUST veer off when approaching the base—and not just a step to either side. VEER OFF!
If he/she does not veer off, they are out. If it impedes the possibility of a double play, the runner closest to home is also out.
If a batted ball leaves the infield, a runner advancing cannot veer off and must go directly to the base. The runner can be tagged out if they lose contact with the base.