Yes. Many modern programming languages have this property, including Algol 60, C, and C++; see below for details.
Algol 60 famously had the dangling else problem, for some programs, it was ambiguous how they should be parsed (what parse tree should be result).
Many modern languages resolve this by picking a grammar that resolves the ambiguity in a particular way. However, this requires carefully constructing the grammar to eliminate ambiguity. Often the most natural way to write the grammar leads to a grammar that is ambiguous, and you have to transform the grammar to avoid the ambiguity.
Another approach is to use a GLR parser, which can handle these grammars. Then you can check at runtime whether there are multiple possible parsers, and resolve the ambiguity.
Another classic example is the C and C++ programming languages. The reference grammar for C is not context-free, because when you see a name, you need to know whether it is the name of a type or of a variable to know how to parse the statement. For instance, consider the expression
(A)*B
If A
is a variable, this is the multiplication of two variables and is equivalent to A*B
. However, if A
is the name of a type, then this is a pointer dereference and type-cast (so B
is a variable name that holds a pointer type), and equivalent to (A) *B
.
Similarly,
A*B;
could be either a variable declaration (if A
is the name of a type, this is declaring a variable named B
whose type is pointer-to-A
) or a multiplication (if A
and B
are the names of variables).
Compilers typically fix this by including extra code that "goes outside" the language of pure context-free grammars. They keep track of all variable names and type names in scope, and use this to guide parsing in case of this ambiguity. See the lexer hack.
See also LL and LR in Context: Why Parsing Tools Are Hard and Bison's manual pages on its GLR parser (which includes a discussion of another ambiguous case in the C++ grammar).
Lastly: I think the question has some confusion about the difference between ambiguity vs non-determinism. Automata and languages can be deterministic/non-deterministic, but not grammars. Grammars and languages can be ambiguous/unambiguous. See Are there inherently ambiguous and deterministic context-free languages? and Grammatical characterization of deterministic context-free languages and If a parser can parse a non-deterministic grammar, is the parser non-deterministic?. The above examples actually qualify both as ambiguous grammars and non-deterministic languages.